package top.yxqin.easymine.eventProcessor;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
import top.yxqin.easymine.PlayerData.PlayerList;
import top.yxqin.easymine.unit.Message;

public class OnPlayerJoin implements Listener
{
    private Plugin plugin;
    public OnPlayerJoin(Plugin plugin)
    {
        this.plugin = plugin;
    }
    @EventHandler
    public void handle(PlayerJoinEvent e)
    {
        new BukkitRunnable()
        {
            @Override
            public   void run()
            {
                PlayerList.addPlayer(e.getPlayer().getName());
                Message.sendDirection(e.getPlayer());
            }
        }.runTaskLater(plugin,4L);
    }
}
